<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ attribute name="navigations" required="true" type="java.util.List"%>
<%@ attribute name="activeTab" required="true"%>
<%@ attribute name="activeSubTab" required="true"%>
<div class="mainnavcontent">
	<ul class="mainnav">
		<c:forEach var="model" items="${navigations}"  varStatus="status">
			<c:set var="active" value="" />
			<c:choose>
				<c:when test="${model.key == activeTab}">
					<c:set var="active" value="current" />
				</c:when>
			</c:choose>
			<c:set var="first" value="" />
			<c:choose>
				<c:when test="${status.first}">
					<c:set var="first" value="fist" />
				</c:when>
			</c:choose>
			<c:set var="last" value="" />
			<c:choose>
				<c:when test="${status.last}">
					<c:set var="last" value="last" />
				</c:when>
			</c:choose>
			<li class="toplink ${active} ${first} ${last}">
				<a href="${appContext}${model.href}">${model.name}</a>
			</li>
		</c:forEach>
	</ul>
</div>
<c:forEach var="model" items="${navigations}">
	<c:set var="active" value="" />
	<c:choose>
		<c:when test="${model.key == activeTab}">
			<c:set var="active" value="current" />
		</c:when>
	</c:choose>
	<ul class="subnav ${active}">
		<c:forEach var="navigationItem" begin="0" items="${model.items}">
			<c:set var="active" value="" />
			
			<c:choose>
				<c:when test="${navigationItem.key == activeSubTab}">
					<c:set var="active" value="current" />
				</c:when>
			</c:choose>
			<li class="level2 ${active}">
				<a	class="${navigationItem.key}" href="${appContext}${navigationItem.href}">
					<img src="${appContext}${navigationItem.icon}" alt="icon" class="icon"/> ${navigationItem.name}
				</a>
			</li>
		</c:forEach>
	</ul>
</c:forEach>

